package com.liveinstars.im.common.dto;

import com.liveinstars.api.dto.ImGetUserInfo;
import com.liveinstars.api.im.vo.ImUserVO;
import com.liveinstars.im.domain.dao.model.ChatGroupMember;
import com.liveinstars.im.domain.dao.model.Friends;

/**
 * @author: zhouze
 * @date: 2020/4/8
 */
public class UserDTO {

    private Friends friends;

    private ChatGroupMember chatGroupMember;

    private ImGetUserInfo imGetUserInfo;


    public UserDTO(Friends friends, ImGetUserInfo imGetUserInfo) {
        this.friends = friends;
        this.imGetUserInfo = imGetUserInfo;
    }

    public UserDTO(ChatGroupMember chatGroupMember, ImGetUserInfo imGetUserInfo) {
        this.chatGroupMember = chatGroupMember;
        this.imGetUserInfo = imGetUserInfo;
    }

    public ImUserVO friendsTransTo() {
        ImUserVO imUserVO = new ImUserVO();
        imUserVO.setUserId(friends.getFriendId());
        imUserVO.setUserName(imGetUserInfo.getUserName());
        imUserVO.setNickName(imGetUserInfo.getNickName());
        imUserVO.setRemarkName(friends.getRemarkName());
        imUserVO.setLogo(imGetUserInfo.getLogo());
        imUserVO.setGroupId(imGetUserInfo.getGroupId());
        imUserVO.setRegdate(Long.valueOf(imGetUserInfo.getRegdate()));
        imUserVO.setIndividualResume(imGetUserInfo.getIndividualResume());
        imUserVO.setVisible(friends.getVisible());
        imUserVO.setShield(null);
        return imUserVO;
    }

    public ImUserVO chatGroupMemberTransTo() {
        ImUserVO imUserVO = new ImUserVO();
        imUserVO.setUserId(chatGroupMember.getUserId());
        imUserVO.setUserName(imGetUserInfo.getUserName());
        imUserVO.setNickName(imGetUserInfo.getNickName());
        imUserVO.setRemarkName(friends.getRemarkName());
        imUserVO.setLogo(imGetUserInfo.getLogo());
        imUserVO.setGroupId(imGetUserInfo.getGroupId());
        imUserVO.setRegdate(Long.valueOf(imGetUserInfo.getRegdate()));
        imUserVO.setIndividualResume(imGetUserInfo.getIndividualResume());
        imUserVO.setNoDisturbing(chatGroupMember.getNoDisturbing());
        imUserVO.setShield(chatGroupMember.getShield());
        return imUserVO;
    }
}
